package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.CustomerFundFlowTransactionType;
import com.rockcent.mall.lib.domain.enumclass.FundTransactionFlow;
import com.rockcent.mall.lib.domain.enumclass.PaymentMethod;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Created by zhangjh on 2016/9/30.
 * 用户资金流
 */
@Entity
@Table(name = "customer_fund_flow")
@DynamicInsert
@DynamicUpdate
public class CustomerFundFlow extends IDEntityMall {

    @Column(columnDefinition = "DECIMAL(30,10) default 0 comment '总金额'")
    private BigDecimal totalAmount = BigDecimal.ZERO;
    @Column(columnDefinition = "DECIMAL(30,10) default 0 comment '冻结金额'")
    private BigDecimal frozen = BigDecimal.ZERO;
    @Column(columnDefinition = "DECIMAL(30,10) default 0 comment '可用金额'")
    private BigDecimal availableAmount =BigDecimal.ZERO;
    @Column(columnDefinition = "bigint comment'客户 钱包 ID'")
    private Long customerFundId;
    @Column(columnDefinition = "bigint comment'客户ID'")
    private Long customerId;
    @Column(columnDefinition = "varchar(255) comment '备注'")
    private String remark;
    @Column(columnDefinition = "DECIMAL(30,10) default 0 comment '操作金额'")
    private BigDecimal operationAmount = BigDecimal.ZERO;
    @Column(columnDefinition = "varchar(50) comment '交易方向 INCOME(\"收入\", \"+\"), EXPEND(\"支出\", \"-\")'")
    @Enumerated(EnumType.STRING)
    private FundTransactionFlow transactionFlow;
    @Column(columnDefinition = "varchar(50) comment '交易类型 ORDER_RECHARGE(\"充值\")'")
    @Enumerated(EnumType.STRING)
    private CustomerFundFlowTransactionType transactionType;
    @Column(columnDefinition = "bigint comment '平台 id'")
    private Long mallId;
    @Column(columnDefinition = "varchar(50) comment '平台订单号 相关订单充值购买,此字段不为空'")
    private String mallOrderNum;
    @Column(columnDefinition = "varchar(30) comment '支付方式 WECHAT(\"微信\"),CASH_COUPON(\"现金券\"),BALANCE(\"余额支付\")'")
    @Enumerated(EnumType.STRING)
    private PaymentMethod paymentMethod;
    @Column(columnDefinition = "bigint comment 'parent_id'")
    private Long parentId;

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }


    public BigDecimal getFrozen() {
        return frozen;
    }

    public void setFrozen(BigDecimal frozen) {
        this.frozen = frozen;
    }

    public Long getCustomerFundId() {
        return customerFundId;
    }

    public void setCustomerFundId(Long customerFundId) {
        this.customerFundId = customerFundId;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getAvailableAmount() {
        return availableAmount;
    }

    public void setAvailableAmount(BigDecimal availableAmount) {
        this.availableAmount = availableAmount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public BigDecimal getOperationAmount() {
        return operationAmount;
    }

    public void setOperationAmount(BigDecimal operationAmount) {
        this.operationAmount = operationAmount;
    }

    public FundTransactionFlow getTransactionFlow() {
        return transactionFlow;
    }

    public void setTransactionFlow(FundTransactionFlow transactionFlow) {
        this.transactionFlow = transactionFlow;
    }

    public CustomerFundFlowTransactionType getTransactionType() {
        return transactionType;
    }

    public void setTransactionType(CustomerFundFlowTransactionType transactionType) {
        this.transactionType = transactionType;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public String getMallOrderNum() {
        return mallOrderNum;
    }

    public void setMallOrderNum(String mallOrderNum) {
        this.mallOrderNum = mallOrderNum;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public PaymentMethod getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(PaymentMethod paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    @Override
    public String toString() {
        return "CustomerFundFlow{" +
                "totalAmount=" + totalAmount +
                ", frozen=" + frozen +
                ", availableAmount=" + availableAmount +
                ", customerFundId=" + customerFundId +
                ", customerId=" + customerId +
                ", remark='" + remark + '\'' +
                ", operationAmount=" + operationAmount +
                ", transactionFlow=" + transactionFlow +
                ", transactionType=" + transactionType +
                ", mallId=" + mallId +
                ", mallOrderNum='" + mallOrderNum + '\'' +
                ", paymentMethod=" + paymentMethod +
                ", parentId=" + parentId +
                '}';
    }
}
